﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using OUSMS.AppLogic.DataAccessLayer;

namespace OUSMS.AppLogic.BusinessLogicLayer
{
    [System.ComponentModel.DataObject(true)]
    public class TitlesBLL:IDisposable
    {
        DatabaseContext _DatabaseContext;
        public TitlesBLL():this(new DatabaseContext())
        { 
        }

        public TitlesBLL(DatabaseContext DatabaseContext)
        {
            _DatabaseContext = DatabaseContext;
        }

        public void Dispose()
        {
            if (_DatabaseContext != null)
            {
                _DatabaseContext.Dispose();
                _DatabaseContext = null;
            }

            GC.SuppressFinalize(this);
        }

        public IQueryable<Titles> GetAllTitles()
        {
            return _DatabaseContext.Titles.Where(t=>!t.IsDeleted);
        }
    }
}